package com.server.pinggu.service.impl;

import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import org.apache.commons.lang3.StringUtils;
import com.server.pinggu.mapper.SenNewsMapper;
import com.server.pinggu.domain.SenNews;
import com.server.pinggu.service.ISenNewsService;

import java.util.List;

/**
 * 【请填写功能名称】Service业务层处理
 *
 * @author ltao
 * @date 2022-10-23
 */
@Service
public class SenNewsServiceImpl extends ServiceImpl<SenNewsMapper, SenNews> implements ISenNewsService {

    @Override
    public List<SenNews> queryList(SenNews senNews) {
        LambdaQueryWrapper<SenNews> lqw = Wrappers.lambdaQuery();
        if (senNews.getTid() != null){
            lqw.eq(SenNews::getTid ,senNews.getTid());
        }
        if (senNews.getPid() != null){
            lqw.eq(SenNews::getPid ,senNews.getPid());
        }
        if (senNews.getUid() != null){
            lqw.eq(SenNews::getUid ,senNews.getUid());
        }
        if (senNews.getSid() != null){
            lqw.eq(SenNews::getSid ,senNews.getSid());
        }
        if (StringUtils.isNotBlank(senNews.getTitle())){
            lqw.eq(SenNews::getTitle ,senNews.getTitle());
        }
        if (StringUtils.isNotBlank(senNews.getAuthor())){
            lqw.eq(SenNews::getAuthor ,senNews.getAuthor());
        }
        if (StringUtils.isNotBlank(senNews.getSource())){
            lqw.eq(SenNews::getSource ,senNews.getSource());
        }
        if (StringUtils.isNotBlank(senNews.getSourceurl())){
            lqw.eq(SenNews::getSourceurl ,senNews.getSourceurl());
        }
        if (StringUtils.isNotBlank(senNews.getResume())){
            lqw.eq(SenNews::getResume ,senNews.getResume());
        }
        if (StringUtils.isNotBlank(senNews.getCont())){
            lqw.eq(SenNews::getCont ,senNews.getCont());
        }
        if (StringUtils.isNotBlank(senNews.getTags())){
            lqw.eq(SenNews::getTags ,senNews.getTags());
        }
        if (senNews.getHits() != null){
            lqw.eq(SenNews::getHits ,senNews.getHits());
        }
        if (senNews.getDttime() != null){
            lqw.eq(SenNews::getDttime ,senNews.getDttime());
        }
        if (senNews.getIstrue() != null){
            lqw.eq(SenNews::getIstrue ,senNews.getIstrue());
        }
        if (senNews.getOrdering() != null){
            lqw.eq(SenNews::getOrdering ,senNews.getOrdering());
        }
        if (StringUtils.isNotBlank(senNews.getPic())){
            lqw.eq(SenNews::getPic ,senNews.getPic());
        }
        if (senNews.getShenhe() != null){
            lqw.eq(SenNews::getShenhe ,senNews.getShenhe());
        }
        if (senNews.getStatus() != null){
            lqw.eq(SenNews::getStatus ,senNews.getStatus());
        }
        if (StringUtils.isNotBlank(senNews.getFiles())){
            lqw.eq(SenNews::getFiles ,senNews.getFiles());
        }
        if (StringUtils.isNotBlank(senNews.getLang())){
            lqw.eq(SenNews::getLang ,senNews.getLang());
        }
        if (senNews.getZan() != null){
            lqw.eq(SenNews::getZan ,senNews.getZan());
        }
        return this.list(lqw);
    }
}